public class Ji_Ou_Change {
    public static void change(int[] arr){
        int i = 0;
        int j = arr.length - 1;
        while (i < j){
            while (i < j && arr[i] % 2 != 0){
                i++;
            }
            while (i < j && arr[j] % 2 == 0){
                j--;
            }
            int tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
        }
    }
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6};
        change(arr);
        for (int i = 0; i < arr.length ; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
